#ifndef B2GDNS_UDP_SERVER_H
#define B2GDNS_UDP_SERVER_H

#include <boost/asio.hpp>

namespace b2gdns { namespace udp {

	class Server
	{
	public:
		Server(boost::asio::io_service& io_service, short port);

	private:
		void handle_receive_from(boost::system::error_code error,
			std::size_t bytes_recvd);
		void handle_send_to(boost::system::error_code error,
			std::size_t bytes_sent);

	private:
		boost::asio::io_service& io_service_;
		boost::asio::ip::udp::socket socket_;
		boost::asio::ip::udp::endpoint sender_endpoint_;
		enum { max_length = 512 }; // max udp length (rfc 1035)
		char data_[max_length];
	};

}} // namespace b2gdns2GDNS::udp

#endif // B2GDNS_UDP_SERVER_H
